﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using Honestysoft.Baseframework.WebUI;

namespace Honestysoft.Financing.WebUI.Module.Audit
{
    /// <summary>
    /// CreateAT 的摘要说明
    /// </summary>
    public class CreateAT : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string id = context.Request.Params["ID"];
            //string code = context.Request.Params["Code"];
            //string batchNo = context.Request.Params["BatchNo"];
            try
            {
                //string filePath = context.Server.MapPath(string.Format("{0}Reports/{1}/{2}.swf",Globals.Home,batchNo,code));
                //string filePath = context.Server.MapPath(string.Format("{0}Reports/{1}/{2}.xlsx", Globals.Home, batchNo, code));
                //if(File.Exists(filePath))
                //{
                //    File.Delete(filePath);
                //}
                string msg = AuditUtils.ExportToExcel(id);
                context.Response.Write(context.Server.UrlEncode(msg));
            }
            catch (Exception ex)
            {
                Honestysoft.BaseLibrary.ExceptionHandling.ExceptionHelper.ExceptionDistribute(ex, false);
                context.Response.Write("0");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}